package cn.com.blueInfo.core.baseService.ddns.utils;

import lombok.extern.log4j.Log4j2;

/**
 *
 * @ClassName: ExceptionInfo
 * @author mymem
 * @date 2023年4月8日  上午11:31:31
 */
@Log4j2
public class ExceptionInfo {

    public static String recordException(Exception e) {
        StringBuilder errStr = new StringBuilder(e.getClass().getName() + ": " + e.getLocalizedMessage());
        StackTraceElement[] trace = e.getStackTrace();
        for (StackTraceElement traceElement : trace)
            errStr.append("\r\n\tat ").append(traceElement);
        log.error(errStr.toString());
        return errStr.toString();
    }

}
